<template>
	<view class="wrap">
		<view class="main-wrap" @click="click">
			<view class="img">
				<!-- <image style="width:100%;border-radius:20rpx;max-height:210rpx;" :src="itemData.imgSrc" mode="widthFix"></image> -->
				<image style="width:100%;border-radius:20rpx;max-height:210rpx;" :src="getImg(itemData.imgSrc)" mode="widthFix"></image>
				<!-- <image style="width:100%;border-radius:20rpx;max-height:210rpx;" src="https://ibms.on-bright.com:28095/file/download?file_id=1846462869893607424" mode="widthFix"></image> -->
			</view>
			<view class="info-wrap">
				<view class="title">{{itemData.title}}</view>
				<view class="tags-wrap">
					<view class="tags-list">
						<view class="tag" v-for="(tag,i) in itemData.tags" :key="i">{{tag}}</view>
					</view>
					<view class="tag-memo">{{itemData.peopleNum}}人 | {{itemData.area}}m²</view>
				</view>
				<view class="memo">
					<view>地址：{{itemData.address}}</view>
					<view>适合：{{itemData.appropriate }}</view>
				</view>
				<view class="preferential-tag" v-if="itemData.preferential">折扣价</view>
				<view class="price-wrap" v-if="showPrice">
					<view class="price">{{itemData.preferential ? itemData.preferential : itemData.origin}}元/{{itemData.minTime==0.5?'半':''}}{{itemData.unit}}</view>
					<view class="origin" v-if="itemData.preferential">{{itemData.origin}}元/{{itemData.minTime==0.5?'半':''}}{{itemData.unit}}</view>
				</view>
			</view>
		</view>
		<slot name="bottom"></slot>
	</view>
</template>

<script>
export default {
  props: {
    itemData: {
      type: Object,
      default: () => ({}),
    },
    showPrice: {
      type: Boolean,
      default: true,
    },
  },
  methods: {
	  getImg(id){
		  return `https://ibms.on-bright.com:28095/file/download?file_id=${id}`
	  },
    click() {
      this.$emit('click');
    },
  },
};
</script>

<style lang="scss" scoped>
.wrap{
	border-bottom: 1px solid rgba(187, 187, 187, .28);;
	.main-wrap{
		display: flex;
	}
	.img{
		width: 190rpx;
	}
	.info-wrap{
		margin-left: 30rpx;
		padding-bottom: 18rpx;
		flex: 1;
		color: #101010;
		.title{
			font-size: 30rpx;
		}
		.tags-wrap{
			padding: 10rpx 0;
			display: flex;
			align-items: center;
			justify-content: space-between;
			gap: 14rpx;
			font-size: 20rpx;
			.tags-list{
				display: flex;
				gap: 8rpx;
				flex-wrap: wrap;
				.tag{
					padding: 8rpx 12rpx;
					// height: 50rpx;
					border-radius: 12rpx;
					background-color: rgba(255, 223, 191, 0.43);
					// border: 1px solid #bbbbbb;
					color: #2F3030;
					display: flex;
					justify-content: center;
					align-items: center;
				}
			}
			.tag-memo{
				color: #A5A5A5;
			}
		}
		.memo{
			padding: 16rpx 0;
			color: #A5A5A5;
			font-size: 22rpx;
		}
		.preferential-tag{
			width: 100rpx;
			height: 40rpx;
			line-height: 40rpx;
			border-radius: 20rpx 0px 20rpx 0px;
			background-color: rgba(255, 107, 0, 0.33);
			color: #101010;
			font-size: 22rpx;
			text-align: center;
		}
		.price-wrap{
			margin-top: 10rpx;
			display: flex;
			.price{
				font-size: 32rpx;
				color: #101010;
				font-family: PingFangSC-regular;
			}
			.origin{
				margin-left: 22rpx;
				font-size: 26rpx;
				text-decoration: line-through;
				color: #C4C4C4;
			}
		}
	}
}
</style>